package cn.iocoder.yudao.module.measure.influxdb;

import com.influxdb.LogLevel;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class InfluxDBConfig {

    @Value("${influxdb.url}")
    private String influxdbHost;
    //
    @Value("${influxdb.token}")
    private String influxdbToken;

    @Bean
    public InfluxDBClient influxDBClient() {
        InfluxDBClient influxDBClient = InfluxDBClientFactory.create(influxdbHost, influxdbToken.toCharArray());
        influxDBClient.setLogLevel(LogLevel.BODY);
        return influxDBClient;
    }


}
